package com.spider.service;

import com.spider.entites.Menu;
import com.spider.mapper.MenuMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author panglin
 * @date 2020/11/19 11:33
 */
@Service
public class MenuService {

    @Resource
    private MenuMapper menuMapper;

    public List<Menu> menus() {
        List<Menu> menuList = this.menuMapper.menus();
        menuList.forEach(menu -> menu.setChildren(this.menuMapper.menu(menu.getId())));
        return menuList;
    }
}
